package com.crm.exception;

import com.crm.result.ResponseResult;
import com.crm.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @ClassName GlobalExceptionHandler
 * @Description
 * @Author 19632
 * @Date 2024/9/14 10:24
 * @Version
 **/
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler
    public ResponseResult handleException(Exception e){
        log.info("全局异常处理器",e);
        return ResponseResult.error("对不起,服务器异常,请联系管理员");
    }

    @ExceptionHandler(BaseException.class)
    public ResponseResult handleStudentException(BaseException e){
        log.info("全局异常处理器",e);
        return ResponseResult.error(e.getMessage());
    }

}
